package com.petshop.controller;

import com.petshop.pojo.Voucher;
import com.petshop.service.VoucherService;
import com.petshop.utils.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/voucher")
@CrossOrigin
public class VoucherController {
    @Resource
    private VoucherService voucherService;

    /**
     * 新增秒杀优惠券
     *
     * @param voucher
     * @return
     */
    @PostMapping("addSecKill")
    public Result addSeckillVoucher(@RequestBody Voucher voucher) {
        voucherService.addSeckillVoucher(voucher);
        return Result.ok(voucher.getId());
    }
}
